<template>
    <div class="">
        <commpVxeTable
            :key="reCommpVxeTable"
            :config="dataTableConfig"
            :columns="columnsVxe"
            :formItem="formItem"
            @checkboxChange="checkboxChange"
            ref="administrativeOffice"
            @searchEvent="searchEvent"
            @resetEvent="resetEvent"
            >
            <template v-slot:editOperation_btn="{row}" data-desc="文件编辑操作栏">
                <a-form layout="inline">
                    <a-form-item>
                        <a
                            href="javascript:;"
                            @click="viewFileModal(row)">
                            {{ row.fwjqc }}
                        </a>
                    </a-form-item>
                </a-form>
            </template>
        </commpVxeTable>
        <viewFileModal ref="viewFileModalRef" :zdwjId="zdwjId"></viewFileModal>
    </div>
</template>
<script>
import  assessCheckApi  from './service/api.js'
import  commpVxeTable   from '@/components/commp-vxe-table/commp-vxe-table.vue'
import viewFileModal from '../editLawsAndRegulations/viewFile.vue'
export default {
    components: {
        commpVxeTable,viewFileModal
    },
    data() {
        return {
            reCommpVxeTable: '',
            dataTableConfig: {
                api: assessCheckApi.list,
                rowId: 'id',
                paramet: {
                }
            },
            columnsVxe: [
                {
                    title: '文件全称',
                    field: 'fwjqc',
                    slots: {
                        default: 'editOperation_btn'
                    }
                },{
                    title: '文件简称',
                    field: 'fwjjc',
                },{
                    title: '版本',
                    field: 'fbb',
                }
            ],
            formItem: [
                {
                    label: '版本',
                    model: 'fbb',
                },{
                    label: '文件简称',
                    model: 'fwjjc',
                },{
                    label: '文件全称',
                    model: 'fwjqc',
                },
            ],
            idList: [],
            modaObj: {},
            zdwjId: '',
        }
    },
    mounted(){
    },
    methods: {
        // 勾选
        checkboxChange(val){
            //console.log('已选择',val)
            this.idList = []
            if(val.length){
                val.forEach(item => {
                    this.idList.push(item.jobid)
                });
            }
        },
        // 搜索
        searchEvent(){
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
            }
        },
        // 重置
        resetEvent(){
            this.dataTableConfig.paramet = {
                ...this.dataTableConfig.paramet,
            }
        },
        // 查看文件内容
        viewFileModal(row){
            this.zdwjId = row.id
            this.$nextTick(_ => {
                this.$refs.viewFileModalRef.viewFileVisible = true
            })
        },
        // 弹窗提交成功
        success(){
            // 刷新表格 清空id数组
            this.$refs.administrativeOffice.resetEvent()
            this.idList = []
        }
    },
}
</script>
